package org.jdesktop.swingx.table.model;

import javax.swing.table.TableModel;

import org.jdesktop.swingx.util.Utilities;

public class SectionTableModelWapper extends AbstractTableModelWapper<TableModel> {

	private int[] columnIndexs;
	
	public SectionTableModelWapper(TableModel t,int[] cols) {
		super(t);
		convertColumnIndexs(cols);
	}


	private void convertColumnIndexs(int[] cols){
		columnIndexs=new int[cols.length];
		for(int i=0;i<cols.length;i++)
			columnIndexs[i]=getWapperColumnNumber(cols[i]);
		columnIndexs=Utilities.removeValue(columnIndexs,-1);
	}
	
	

	@Override
	public int getColumnCount() {
		return columnIndexs.length;
	}


	@Override
	public int getColumnIndex(int wapperColumnIndex) {
		return columnIndexs[wapperColumnIndex];
	}
	
	@Override
	public int getRowIndex(int wapperRowIndex) {
		return wapperRowIndex;
	}
}
